package com.team622.shop.goods.service.interceptors;

import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;

/**
 * 授权拦截器
 *
 * @author team622
 * @since 2025-07-02
 */
@Slf4j
@Component
public class AuthorizationInterceptor implements HandlerInterceptor {


    /**
     * 拦截器前置处理
     */
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        String token = request.getHeader("Authorization");
        long id = Thread.currentThread().getId();
        log.info("AuthorizationInterceptor preHandle id:{}", id);
        return true;
    }
}
